<template>
	<view class="page-bottom">
		<uni-loding :loading='loading'></uni-loding>
		<view class="parse-title-box">
			<!-- style="width: calc(100% - 60rpx);padding:30rpx" -->
			<view class="title">
				{{data.title || data.name}}
			</view>
			<view class="flex-box">
				<view class="time">
					{{data.created_at}}
				</view>
				<u-icon name="eye" color="#999" size="14" labelPos="right" labelSize="12" labelColor="#999"
					:label="data.count"></u-icon>
			</view>
		</view>
		<!-- <richTextDom :info="info" style="font-size: 30rpx;color: #666;"/> -->
		<!-- <u-parse :content="info" style="font-size: 30rpx;color: #666;" /> -->
		<u-parse :content="info" class="parse-box" />
	</view>
</template>

<script>
	import richTextUtil from '@/utils/richTextUtil.js';
	import uParse from '@/components/u-parse/u-parse.vue';
	export default {
		components: {
			uParse
		},
		data() {
			return {
				info: '',
				loading: true,
				data: '',
				sn: '',
				type: 1,
				headTitle: ''
			}
		},
		onLoad(param) {
			this.type = param.type;
			this.init(param.sn);
		},
		methods: {
			init(sn) {
				let that = this;
				let url = '';
				switch (this.type) {
					case '1':
						url = '/index/news_detail/';
						this.headTitle = '资讯详情'
						break;
					default:
						url = '/index/notice_detail/';
				}
				this.$func.request(url + sn).then(res => {
					that.data = res.data.data;
					that.info = richTextUtil.formatRichText(res.data.data.content);
					that.loading = false;
				})
			},
		}
	}
</script>

<style scoped>
	.title {
		font-size: 48rpx;
		font-weight: bold;
		color: #000;
	}

	.time {
		font-size: 24rpx;
		color: #999;
		margin-right: 10rpx;
	}

	.parse-title-box {
		padding: 40rpx;
		box-sizing: border-box;
	}

	.page-bottom {
		display: flex;
		flex-direction: column;
		height: 100vh;
	}

	.flex-box {
		display: flex;
		align-items: center;
		margin-top: 28rpx;
	}

	.parse-box {
		flex: 1;
		padding: 20rpx 20rpx 100rpx;
		overflow: auto;

	}
</style>